package www.sofn.com.goods;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import www.sofn.com.domain.R;
import www.sofn.com.goods.domain.query.GoodsDisplayQuery;
import www.sofn.com.goods.domain.vo.GoodsDisplayInfoVO;
import www.sofn.com.goods.domain.vo.GoodsDisplayListHostVO;

@RestController
@RequestMapping("goods_display")
@Tag(name = "获取商品信息")
public class GoodsDisplayController {
    @Resource
    private GoodsDisplayService service;

    @Operation(summary = "获取热门商品")
    @GetMapping
    public R<GoodsDisplayListHostVO> listHost(GoodsDisplayQuery query){
        return R.ok(service.listHost(query));
    }

    @GetMapping("/{id}")
    @Operation(summary = "获取商品详情")
    public R<GoodsDisplayInfoVO> getGoodsInfo(@PathVariable(name = "id",required = true)String id){
        return R.ok(service.getGoodsDisplayInfoById(id));
    }
}
